<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

?>
<?php use_stylesheet('/sfPropelPlugin/css/global.css') ?>
<?php use_stylesheet('/sfPropelPlugin/css/default.css') ?>
<?php use_helper('Form')?>

<div id="sf_admin_container">
    <div id="sf_admin_content">
        <div><h2>Lista de Cuentas Corrientes</h2></div>
<table>
    
    <thead>
        <th>Cliente</th>
        <th>Total Deuda</th>
        <th>Total Abonado</th>
        <th>Total Saldo</th>
        <th>Acciones</th>
    </thead>
    <tbody>
        <?php $totalfac = 0; $totalpag = 0;foreach($ctasctes as $ctasctes):?>
        <tr>

            <td>
              <?php echo $ctasctes['nombre'].', '.$ctasctes['apellido'] ?>
            </td>
            <td>
              <?php echo number_format($ctasctes['total'],0,'','.').' Gs'?>
            </td>
            <td>
               <?php echo number_format($ctasctes['pagado'],0,'','.').' Gs'?>
            </td>
            <td>
                <?php echo  number_format(( $ctasctes['total'] - $ctasctes['pagado']),0,'','.').' Gs'  ?>
            </td>
            <td>
                <?php echo button_to('Ver', 'clientes/Listctasctes?id='.$ctasctes['id'])?>
                <?php //echo button_to('Ver Pagos', 'facturas/ListDetpagos?id='.$ctasctes['id'])?>
            </td>
        </tr>
        <?php $totalfac += $ctasctes['total'];
               $totalpag += $ctasctes['pagado']; 
               
        endforeach;
            $totalSaldo =  $totalfac - $totalpag;
        ?>
    </tbody>
    <tfoot>
        <tr><th>Totales </th><th><?php echo number_format($totalfac,0,'','.').' GS'?> </th><th><?php echo number_format($totalpag,0,'','.').' GS'?> </th><th><?php echo number_format($totalSaldo,0,'','.').' GS'?></th><th></th></tr>
    </tfoot>
</table>

    </div>
</div>